-- Picture
-- Created by cheny3 Jun/12/2016
-- 纯图片格子

-- 初始化
function initPicture(self)
    local pos = self.gridData:getPos();
    local class = self.gridData.class;
    local element = self.gridData.element;
    local dbase = DungeonM.queryElement(element, "dbase");

    if not dbase then
        error("获取不到建筑查看配置，元素类型：" .. class);
        return;
    end

    -- 建筑图标
    local iconPath = getLevelItemIconPath(dbase["icon"]);
    local offset = dbase["offset"] or {0, 0};

    self.icon = ccui.ImageView:create(iconPath);
    self.icon:setTouchEnabled(false);
    self.icon:setPositionX(self.icon:getPositionX() + offset[1]);
    self.icon:setPositionY(self.icon:getPositionY() + offset[2]);
    self.item:addChild(self.icon);
    self.iconPath = iconPath;
end
